<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8" />
    <title>修改菜单</title>
    <script src="/plugin/jquery/jquery-1.9.0.min.js" type="text/javascript"></script>
    <link href="/plugin/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
    <link href="/plugin/ligerUI/skins/Gray/css/all.css" rel="stylesheet"/>
    <link href="/css/form.css" rel="stylesheet"/>

    <script src="/plugin/ligerUI/js/core/base.js" type="text/javascript"></script>
    <script src="/plugin/ligerUI/js/ligerui.all.js" type="text/javascript"></script>
</head>
<body style="margin: 10px;">
<form id="subForm">
    <div class="formDiv" style="width: 90%;" th:object="${secMenu}">
        <div class="formLine">
            <input  type="hidden" name="id" th:value="*{id}">
            <!--<input  type="hidden" name="orgId" value="">-->
            <div class="formInp">
                <span>菜单编号：</span>
                <input class="blue testTxt" type="text" name="menuCode" disabled th:value="*{menuCode}"/>
            </div>
            <div class="formInp">
                <span>菜单名称：</span>
                <input class="blue testTxt" type="text" name="menuName" th:value="*{menuName}"/>
            </div>
        </div>
        <div class="formLine">
            <div class="formInp">
                <span>菜单类型：</span>
                <select class="blue testTxt" name="menuType" th:value="*{menuType}">
                    <div th:if="*{menuType eq 0}">
                        <option selected value="0">按钮</option>
                        <option value="1">菜单</option>
                    </div>
                    <div th:if="*{menuType eq 1}">
                        <option value="0">按钮</option>
                        <option selected value="1">菜单</option>
                    </div>
                </select>
            </div>
            <div class="formInp">
                <span>打开方式：</span>
                <select class="blue testTxt" name="openType" th:value="*{openType}">
                    <div th:if="*{openType eq 0}">
                        <option selected value="0">新页面</option>
                        <option value="1">模块窗口</option>
                    </div>
                    <div th:if="*{openType eq 1}">
                        <option value="0">新页面</option>
                        <option selected value="1">模块窗口</option>
                    </div>
                </select>
            </div>
        </div>

        <div class="formLine">
            <div class="formInp">
                <span>链接地址：</span>
                <input class="blue testTxt" type="email" name="url" th:value="*{url}"/>
            </div>
            <div class="formInp">
                <span>显示排序：</span>
                <select class="blue testTxt" name="sort">
                    <option  th:each="sort: ${sorts}" th:value="${sort}" th:text="${sort}" th:selected="${sort==secMenu.sort}? true : false"></option>
                </select>
            </div>
        </div>

        <div class="formLine">
            <div class="formInp">
                <span>是否可用：</span>
                <select class="blue testTxt" name="enabled" th:value="*{enabled}">
                    <div th:if="*{enabled eq 1}">
                        <option value="0">否</option>
                        <option selected value="1">是</option>
                    </div>
                    <div th:if="*{enabled eq 0}">
                        <option selected value="0">否</option>
                        <option value="1">是</option>
                    </div>
                </select>
            </div>
        </div>

        <div class="formLine">
            <div class="btn">
                <a href="javascript:;" onclick="sub();">保存数据</a>
            </div>
        </div>
    </div>
</form>
</body>
<script type="text/javascript">
    function sub (){
        var data = $("#subForm").serialize();
        $.ajax({
            type: 'POST',
            url: 'update',
            data: data,
            dataType: 'json',
            success: function(data){
                if(data.code==200){
                    parent.callBack();
                }else{
                    $.ligerDialog.error('保存失败');
                }
            },
            error:function(){
                $.ligerDialog.error('保存失败');
            }
        });
    }
</script>
</html>